# Create your models here.

from django.db import models
from django.contrib.auth.models import User

import datetime

class Users(models.Model):
    user = models.ForeignKey(User)
    UU_CHOICES = (
     (u'T', u'Teacher'),
     (u'S', u'Students'),
    )
    name = models.CharField(max_length=60)
    uu = models.CharField(max_length=2, choices=UU_CHOICES)

class Exam (models.Model):
    exam_id = models.IntegerField()
    name = models.CharField(max_length=64)
    date_created = models.DateField('date created')
    date_valid = models.DateField()
    date_expired = models.DateField()
    user_id = models.ForeignKey(Users)
    teachers_name = models.CharField(max_length=30)
    descriptions = models.CharField(max_length=256)

class Question(models.Model):
    Questions_Number = models.IntegerField()
    exam_id= models.ForeignKey(Exam)
    question_descriptions = models.CharField(max_length=200)

class Question_Answer_Item(models.Model):
    answers_id = models.BooleanField()
    Questions_id = models.ForeignKey(Question)
    answer_text= models.CharField(max_length=200)
    right_answer = models.BooleanField()

class Exam_Taken(models.Model):
     user_id = models.ForeignKey(Users)
     Exams_id = models.ForeignKey(Exam)
     Exams_name = models.CharField(max_length=30)
     students_name = models.CharField(max_length=30)
